package com.f5.management.utils;


import com.f5.management.enums.StateEnum;
import lombok.Data;
import lombok.experimental.Accessors;

@Data
@Accessors(chain = true)
public class ResponseResult<T> {
    private int code;            //状态码200 404 500
    private StateEnum state;        //状态
    private String message;        //提示信息
    private T data;                //返回的数据

    public ResponseResult(boolean state) {
        super();
        if (state) {
            this.setCode(200);
            this.setState(StateEnum.SUCCESS);
            this.setMessage("操作成功！");
        } else {
            this.code = 500;
            this.state = StateEnum.FAIL;
            this.message = "操作失败";
        }
    }

}
